//
//  SignInTableViewCell.m
//  HarmonizePub
//
//  Created by rzhy on 2017/1/10.
//  Copyright © 2017年 Zy. All rights reserved.
//

#import "SignInTableViewCell.h"
#import "Config.h"
#import "SignIn.h"

@interface SignInTableViewCell ()

@property (weak, nonatomic) IBOutlet UIView *mainView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *depNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *numLabel;
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
@property (weak, nonatomic) IBOutlet UIButton *signButton;

@end

@implementation SignInTableViewCell

+ (NSString *)registerName {
    return @"SignInTableViewCell";
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.mainView.layer.masksToBounds = NO;
    self.mainView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    self.mainView.layer.shadowOffset = CGSizeMake(1.0f, 1.0f);
    self.mainView.layer.shadowOpacity = 0.5f;
    self.signButton.layer.cornerRadius = 5.0f;
    self.signButton.layer.masksToBounds = YES;
}

+ (CGFloat)cellHeight {
    return 228.0f;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setSignIn:(SignIn *)signIn {
    _signIn = signIn;
    self.nameLabel.text = [NSString stringWithFormat:@"%@(%@)", signIn.brxm, signIn.jzkh];
    self.depNameLabel.text = signIn.ksmc;
    self.numLabel.text = signIn.wdhs;
    self.dateLabel.text = signIn.jzrq;
}

- (void)setIsClick:(BOOL)isClick {
    _isClick = isClick;
}

#pragma mark - 立即签到
- (IBAction)signInEvent:(UIButton *)sender {
    SignInTableViewCell *cell = (SignInTableViewCell *)sender.superview.superview.superview;
    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
    if ([self.delegate respondsToSelector:@selector(tableViewCell:didSignIn:indexPath:)])
        [self.delegate tableViewCell:self didSignIn:self.signIn indexPath:indexPath];
}

@end
